<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
	<meta charset="utf-8" />
	<title>{weixin:$metaTitle}</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" />
	<meta name="format-detection" content="telephone=no" />
    <link type="text/css" rel="stylesheet" href="{weixin::$staticFilePath}/css/style.css" />
    <link type="text/css" rel="stylesheet" href="/tpl/Wap/default/common/css/products/4/css/style.css" />
	<script src="{weixin::$staticFilePath}/js/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="{weixin::$staticFilePath}/js/main.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src='/tpl/Wap/default/js/share.js'></script>
    <script type="text/javascript">
	var title = "全部专家";
    var desc  = "{weixin:$wxshop.wxshop_desc}";
	var link  = "{weixin::C('site_url')}/index.php?g=Wap&m=Expert&a=experts&token={weixin:$_GET['token']}}";
	var imgUrl = "{weixin::C('link_shop_url')}{weixin:$wxshop.wxshop_logo}";
	appId= '{weixin:$signPackage["appId"]}';
    timestamp = '{weixin:$signPackage["timestamp"]}';
    nonceStr = '{weixin:$signPackage["nonceStr"]}';
    signature= '{weixin:$signPackage["signature"]}';
	$(function(){ 
  		share(title,desc,link,imgUrl,appId,timestamp,nonceStr,signature);
 	}); 
	$(document).ready(function(){
     $.ajax({
        type:"get",
        cache:false,
        url:"{weixin::U('Expert/asyncExperts',array('token'=>$_GET['token']))}",
        dataType:"json",
        beforeSend:function(){
		   $("#spinner").show();
        },
        success:function(data){
		 //  alert("success");
           //alert(data.url);
		   window.location.href=data.url;
		 
        },
		error:function(XMLHttpRequest, textStatus, errorThrown){
    		//	 alert(XMLHttpRequest.status);
              //   alert(XMLHttpRequest.readyState);
               //  alert(textStatus);
    		 },    	
        complete: function() {$("#spinner").remove();
        }

     })
	})
    </script>

    <style>
    .soldout {
    display: block;
    width: 91px;
    height: 89px;
    position: absolute;
    top: 5%;
	*top: 10%;
    left: 29%;
    margin: 10px 0px 0px -83px;
   }
   .spinner {
  text-align: center;
  height:100%; width:100%; position:fixed; _position:absolute; top:50%;z-index:999999
   }
 
.spinner > div {
  width: 30px;
  height: 30px;
  background-color: #67CF22;
 
  border-radius: 100%;
  display: inline-block;
  -webkit-animation: bouncedelay 1.4s infinite ease-in-out;
  animation: bouncedelay 1.4s infinite ease-in-out;
  /* Prevent first frame from flickering when animation starts */
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}
 
.spinner .bounce1 {
  -webkit-animation-delay: -0.32s;
  animation-delay: -0.32s;
}
 
.spinner .bounce2 {
  -webkit-animation-delay: -0.16s;
  animation-delay: -0.16s;
}
    </style>
</head>

<body style="line-height:1.6">
<div class="spinner" id="spinner" style="display:none">
  <div class="bounce1"></div>
  <div class="bounce2"></div>
  <div class="bounce3"></div>
</div>
<include file="Expert:menu"/>
<!--主体-->
	<form class="f_index_search clearfix" action="" method="post" id="search_form">
				<input type="text" id="search_name" name="search_name" class="search_box" placeholder="请输入搜索关键字" />
		<input type="submit" class="search_button" value="搜 索" />
	</form>
<section class="f_list i_list" >
		<ul class="clearfix" id="f_list">
		<volist name="experts" id="hostlist"> 
			<li>
			<div>
				<a href="{weixin::U('Expert/expertDetail',array('token'=>$_GET['token'],'expert_id'=>$hostlist['expert_id']))}">
					<img src="{weixin:$hostlist.head_img}" />
					<h3 style="color:#888; line-height:1.6; font-weight:normal;height: 20px; overflow:hidden; font-size:14px;">{weixin:$hostlist.expert_name}</h3>
					<h3 style="color:#888; line-height:1.6; font-weight:normal;height: 20px; overflow:hidden; font-size:14px;">{weixin:$hostlist.expert_level}，{weixin:$hostlist.expert_title}</h3>
					<h3 style="color:#888; line-height:1.6; font-weight:normal;height: 20px; overflow:hidden; font-size:14px;">{weixin:$hostlist.keywords}</h3>
				</a>
			</div>
		    </li>
		</volist>
		</ul>
	</section>
    <include file="Product:footer"/>
<a class="more" id="show_more" page="2" style="display: none;" href="javascript:void(0);">加载更多</a>
	<input type="hidden" value="1" id="pageid" />
	<input type="hidden" id="canScroll" value="1" />
<script type="text/javascript">
$(function() {
	$('#search_form').submit(function() {
		var search_name = $('#search_name').val();
		if (search_name == '') {
			return false;
		}
	});

	//点击排序
	var base_url = '{weixin::U('Expert/experts',array('token'=>$_GET['token'],'catid'=>$thisCat['cat_id'],'wecha_id'=>$_GET['wecha_id']))}';
	var b_url = '<if condition="$isSearch neq 1">{weixin::U('Expert/ajaxExperts',array('token'=>$_GET['token'],'catid'=>$thisCat['cat_id'],'wecha_id'=>$_GET['wecha_id']))}<else/>{weixin::U('Expert/ajaxExperts',array('token'=>$_GET['token'],'keyword'=>$_GET['keyword'],'wecha_id'=>$_GET['wecha_id']))}</if>'
		method = 'DESC',
		_get_method = '{weixin:$method}',
		order = '{weixin:$order}',
		_get_order  = '';
	if (_get_order != '') {
		order = _get_order;
	}
	$('.tab_control a').removeClass('on');
	$('.tab_control a[order="' + order + '"]').addClass('on');

	if (_get_method == 'DESC')  {
		method = 'ASC';
	}
	$('.tab_control a').click(function() {
		var order = $(this).attr('order');
		var url = base_url + '&order=' + order+'&method='+method;
		location.href = url;
	});

	/*---------------------加载更多--------------------*/
	var total = {weixin:$count},
		pagesize = 10,
		pages = Math.ceil(total / pagesize);
	var com_link = '{weixin::U('Expert/expertDetail',array('token'=>$_GET['token']))}';

	var label_arr = ["\u8bf7\u9009\u62e9\u6807\u7b7e","\u70ed\u5356","\u7206\u6b3e"];

	if (pages > 1) {
		var _page = $('#show_more').attr('page');
		$(window).bind("scroll",function() {
			if ($(document).scrollTop() + $(window).height() >= $(document).height()) {
				if (_page > pages) {
					$('#show_more').show().html('没有更多了').delay(2300).slideUp(1600);
					return;
				}
				$('#show_more').show().html('加载中...');
				
				if($('#canScroll').val()==0){//不要重复加载
					return;
				}
				$('#canScroll').attr('value',0);
				$.ajax({
					type : "GET",
					data : {'page' : _page, 'inajax' : 1},
					url :  b_url + '&order=' + order + '&method=' + method + '&pagesize='+pagesize,
					dataType : "json",
					success : function(RES) {
						$('#canScroll').attr('value',1);
						$('#show_more').hide().html('加载更多');
						
						data = RES.experts;
						
						//alert(b_url + 'order=' + order + '&method=' + method + '&pagesize='+pagesize)
						if(data.length){
						$('#show_more').attr('page',parseInt(_page)+1);
						}
						_page = $('#show_more').attr('page');
						var _tmp_html = '';
						$.each(data, function(x, y) {
							_tmp_html +=    '<li><div>' +
							'<a href="' + com_link + '&expert_id=' + y.expert_id + '">' +
							'<img src="' +y.head_img + '" />' +
							'<h3 style="color:#888; line-height:1.6; font-weight:normal;height: 20px; overflow:hidden; font-size:14px;">' + y.expert_name + '</h3>' +
							'<h3 style="color:#888; line-height:1.6; font-weight:normal;height: 20px; overflow:hidden; font-size:14px;">' + y.expert_level + ', ' + y.expert_title + '</h3>' +
							'<h3 style="color:#888; line-height:1.6; font-weight:normal;height: 39px; overflow:hidden; font-size:14px;">'+ y.keywords +'</h3>' +
							'</a>'
							;
							if (y.product_label > 0) {
								_tmp_html += 	'<div class="hot">' +
								'<strong></strong>' +
								'</div>';
							}
							_tmp_html += '</div></li>';
						});
						$('#f_list').append(_tmp_html);
						
					}
				});
			}
		});

		
	}
});
</script>
</body>
</html>